﻿<Application x:Class="StockManagement.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
       xmlns:helper="clr-namespace:StockManagement.Helper"
             StartupUri="Views/MainWindow.xaml">
    <Application.Resources>
        <!-- Generic brushes -->
        <SolidColorBrush x:Key="DefaultControlBorderBrush" Color="#FF688CAF"/>
        <SolidColorBrush x:Key="DefaultControlBackgroundBrush" Color="#FFE3F1FE"/>
        <SolidColorBrush x:Key="DefaultControlForegroundBrush" Color="#FF10257F"/>

        <!-- DataGrid related brushes -->
        <SolidColorBrush x:Key="GridLineColorBrush" Color="#FFCEDFF6" />
        <LinearGradientBrush x:Key="AlternateRowBackgroundBrush" StartPoint="0.5,0.0" EndPoint="0.5,1.0">
            <GradientStop Color="#FFFEFEFF" Offset="0"/>
            <GradientStop Color="#FFE4F0FC" Offset="1"/>
        </LinearGradientBrush>

        <!-- Header related brushes -->
        <SolidColorBrush x:Key="HeaderBorderBrush" Color="#88B0E4"/>
        <SolidColorBrush x:Key="HeaderInnerBorderBrush" Color="#FFFFFF" />
        <LinearGradientBrush x:Key="HeaderBackgroundBrush"
                                                 StartPoint="0.5,0.0" EndPoint="0.5,1.0">
            <GradientStop Color="#FF98BFEB" Offset="0"/>
            <GradientStop Color="#FFB8D4F2" Offset="1"/>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="HeaderHighlightedBackgoundBrush"
                                                 StartPoint="0,0" EndPoint="0,1">
            <GradientStop Color="#FFA3CBF7" Offset="0"/>
            <GradientStop Color="#FFD9E6F9" Offset="1"/>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="HeaderPressedBackgroundBrush"
                                                 StartPoint="0,0" EndPoint="0,1">
            <GradientStop Color="#FFA3CBF7" Offset="1"/>
            <GradientStop Color="#FFD9E6F9" Offset="0"/>
        </LinearGradientBrush>

        <!-- DataGridColumnHeader Style -->
        <Style TargetType="{x:Type DataGridColumnHeader}">
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="Background" Value="{StaticResource HeaderBackgroundBrush}"/>
            <Setter Property="BorderBrush" Value="{StaticResource HeaderBorderBrush}" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Padding" Value="3" />
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="FontSize" Value="10.5" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="IsTabStop" Value="False" />
        </Style>

        <!-- DataGridRowHeader Style -->
        <Style TargetType="{x:Type DataGridRowHeader}">
            <Setter Property="Background" Value="{StaticResource HeaderBackgroundBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource HeaderBorderBrush}" />
        </Style>

        <Style TargetType="{x:Type DataGridCell}">
            <Setter Property="Padding" Value="5" />
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="VerticalAlignment" Value="Stretch" />
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
        </Style>

        <Style TargetType="{x:Type DataGrid}">            
            <Setter Property="Background"
                                        Value="{StaticResource DefaultControlBackgroundBrush}"/>
            <Setter Property="Foreground"
                                        Value="{StaticResource DefaultControlForegroundBrush}"/>
            <Setter Property="BorderBrush"
                                        Value="{StaticResource DefaultControlBorderBrush}" />
            <Setter Property="HorizontalGridLinesBrush"
                                        Value="{StaticResource GridLineColorBrush}" />
            <Setter Property="VerticalGridLinesBrush"
                                        Value="{StaticResource GridLineColorBrush}" />
            <Setter Property="AlternatingRowBackground"
                                        Value="{StaticResource AlternateRowBackgroundBrush}" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="RowHeaderWidth" Value="25"></Setter>
            <Setter Property="MinRowHeight" Value="25"></Setter>
            <Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Recycling"></Setter>
            <Setter Property="MinColumnWidth" Value="50"/>
            <Setter Property="AutoGenerateColumns" Value="False"/>
            <Setter Property="CanUserDeleteRows" Value="False"/>
            <Setter Property="Margin" Value="5"/>
        </Style>

        <Style TargetType="{x:Type Button}">
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="Background" Value="{StaticResource GridLineColorBrush}"/>
            <Setter Property="BorderBrush" Value="{StaticResource HeaderBorderBrush}" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Padding" Value="3" />
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="FontSize" Value="10.5" />
            <Setter Property="FontWeight" Value="SemiBold" />
            <Setter Property="MinWidth" Value="80" />
            <Setter Property="HorizontalAlignment" Value="Right" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Margin" Value="5" />
        </Style>
        
        <!-- The ObjectDataProvider exposes the enum as a binding source -->
        <ObjectDataProvider
            x:Key="productType"
            MethodName="GetValues"
            ObjectType="{x:Type  sys:Enum}" >
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="helper:EnumMaterialType"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider
            x:Key="productStatus"
            MethodName="GetValues"
            ObjectType="{x:Type  sys:Enum}" >
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="helper:ProductStatus"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider
            x:Key="dgShowProducts"
            MethodName="GetValues"
            ObjectType="{x:Type  sys:Enum}" >
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="helper:DGShowProduct"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider
            x:Key="materialType"
            MethodName="GetValues"
            ObjectType="{x:Type sys:Enum}" >
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="helper:EnumMaterialType"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider
            x:Key="dgShowMaterials"
            MethodName="GetValues"
            ObjectType="{x:Type  sys:Enum}" >
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="helper:DGShowMaterial"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <Style x:Key="textBoxInError" TargetType="{x:Type TextBox}">
            <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="true">
                    <Setter Property="ToolTip"
        Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                        Path=(Validation.Errors)[0].ErrorContent}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Application.Resources>
</Application>
